clc,clear,close all;
g1 = zeros(600, 600);
g1(100:500, 250:350) = 1;
g2 = phantom('Modified Shepp-Logan',600);
D = 1.5*hypot(size(g1, 1),size(g1,2))/2;
B1_line = fanbeam(g1, D, 'FanSensorGeometry',...
    'line','FanSensorSpacing',1,...
    'FanRotationIncrement',0.5);
B2_arc = fanbeam(g2, D, 'FanSensorGeometry', 'arc',...
    'FanSensorSpacing', .08, 'FanRotationIncrement', 0.5);
P1_line = fan2para(B1_line,D,'FanRotationIncrement',0.5,...
    'FanSensorGeometry','line',...
    'FanSensorSpacing',1,...
    'ParallelCoverage','halfcycle',...
    'ParallelRotationIncrement', 0.5,...
    'ParallelSensorSpacing',1);
P2_arc = fan2para(B2_arc, D, 'FanRotationIncrement',0.5,...
    'FanSensorGeometry','arc',...
    'FanSensorSpacing',0.08,...
    'ParallelCoverage','halfcycle',...
    'ParallelRotationIncrement', 0.5,...
    'ParallelSensorSpacing',1);
P1_line = flipud(P1_line');
P2_arc = flipud(P2_arc');
figure
subplot(121),imshow(P1_line, [])
title('矩形平行射线束投影')
subplot(122),imshow(P2_arc, [])
title('头部幻影图像平行射线束投影')